from ..background import Image
from ..rect import Rect

class Icon:
  def __init__(self, filename, hmargin=0, vmargin=0):
    self.image = Image(filename)
    self.hmargin = hmargin
    self.vmargin = vmargin

  def GetWidth(self):
    return self.image.GetMinWidth()

  def GetHeight(self):
    return self.image.GetMinHeight()

  def Draw(self, window, x, y, clip_rect):
    self.image.Draw(window, Rect((x, y, self.GetWidth(), self.GetHeight())),
        clip_rect)

  def GetHorizontalMargin(self):
    return self.hmargin

  def GetVerticalMargin(self):
    return self.vmargin

